package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WmsInventoryStatistics;
import com.ruoyi.system.service.IWmsInventoryStatisticsService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 库存统计Controller
 *
 * @author ruoyi
 * @date 2025-06-25
 */
@RestController
@RequestMapping("/system/wmsInventoryStatistics")
public class WmsInventoryStatisticsController extends BaseController
{
    @Autowired
    private IWmsInventoryStatisticsService wmsInventoryStatisticsService;

    /**
     * 查询库存统计列表
     */
    @SaCheckPermission("system:wmsInventoryStatistics:list")
    @GetMapping("/list")
    public TableDataInfo<WmsInventoryStatistics> list(WmsInventoryStatistics wmsInventoryStatistics, PageQuery pageQuery)
    {
        return wmsInventoryStatisticsService.selectWmsInventoryStatisticsList(wmsInventoryStatistics,pageQuery);
    }

    /**
     * 导出库存统计列表
     */
    /*@SaCheckPermission("system:wmsInventoryStatistics:export")
    @Log(title = "库存统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsInventoryStatistics wmsInventoryStatistics)
    {
        List<WmsInventoryStatistics> list = wmsInventoryStatisticsService.selectWmsInventoryStatisticsList(wmsInventoryStatistics);
        ExcelUtil<WmsInventoryStatistics> util = new ExcelUtil<WmsInventoryStatistics>(WmsInventoryStatistics.class);
        util.exportExcel(response, list, "库存统计数据");
    }*/

    /**
     * 获取库存统计详细信息
     */
    @SaCheckPermission("system:wmsInventoryStatistics:query")
    @GetMapping(value = "/{id}")
    public R<WmsInventoryStatistics> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(wmsInventoryStatisticsService.selectWmsInventoryStatisticsById(id));
    }

    /**
     * 新增库存统计
     */
    @SaCheckPermission("system:wmsInventoryStatistics:add")
    @Log(title = "库存统计", businessType = BusinessType.INSERT)
    @PostMapping
    public R<Void> add(@RequestBody WmsInventoryStatistics wmsInventoryStatistics)
    {
        return toAjax(wmsInventoryStatisticsService.insertWmsInventoryStatistics(wmsInventoryStatistics));
    }

    /**
     * 修改库存统计
     */
    @SaCheckPermission("system:wmsInventoryStatistics:edit")
    @Log(title = "库存统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<Void> edit(@RequestBody WmsInventoryStatistics wmsInventoryStatistics)
    {
        return toAjax(wmsInventoryStatisticsService.updateWmsInventoryStatistics(wmsInventoryStatistics));
    }

    /**
     * 删除库存统计
     */
    @SaCheckPermission("system:wmsInventoryStatistics:remove")
    @Log(title = "库存统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R<Void> remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsInventoryStatisticsService.deleteWmsInventoryStatisticsByIds(ids));
    }
}
